/*
 * DirectMessage.java
 *
 * Created on 7 październik 2007, 18:53
 *
 */

package kosciak.blip4j;

import java.util.Date;
import java.util.List;

/**
 * <CODE>DirectMessage</CODE> object represents a direct message in Blip.pl
 * It's an Update of type dirmsg
 * @author Wojtek 'KosciaK' Pietrzok
 * @since 0.1
 */
public abstract class DirectMessage extends Update{
    
    private User to;
    
    /**
     * Creates an instance of DirectMessage
     * @param id an Id of a DirectMessage
     * @param body a body od a DirectMessage
     * @param date a Date of a DirectMessage
     * @param from a User who sent a DirectMessage
     * @param to a User to whom a DirectMessage was sent
     * @param transport a Transport of a DirectMessage
     * @param pictures a List of Pictures attached to a DirectMessage
     */
    protected DirectMessage(int id, 
                            String body, 
                            Date date, 
                            User from, 
                            User to,
                            Transport transport,
                            List<Picture> pictures) {
        
        super(id, body, date, UpdateType.DirMsg, from, transport, pictures);
        this.to = to;
    }
    
    /**
     * Gets a User to whom the Direct Message was sent
     * @return a User to wom the Direct Message was sent
     */
    public User getTo() {
        return to;
    }
    
    @Override
    public String toString() {
        return "" + getFrom() + " > " + getTo() + ": " + getBody();
    }
    
}
